<template>
	<scroll-view scroll-y="true" class="container_scrollview" :show-scrollbar="false">
		<view class="container">
			<view class="kuang">
				<u-tabs :list="list1" @click="click"></u-tabs>
			</view>

			<!-- 菜单 -->
			<view class="kuang" v-for="item in yhqlist">
				<view class="quan">
					<view class="fl_ju">
						<view class="title">
							{{item.couponName}}券
						</view>
						<view class="qian">
							¥{{item.couponAmount/100}}
						</view>
					</view>
					<view class="fl_ju" style="margin: 30rpx 0;">
						<view class="time">
							有效期：{{item.startTime}}至{{item.endTime}}
						</view>
						<view class="man">
							{{item.usageConditionDisplay}}
						</view>
					</view>
					<view class="" style="display: flex;justify-content: flex-end;">
						<view class="" style="width: 200rpx;">
							<u-button text="去使用" color="linear-gradient(to right,#3AA3FF, #005DFF)"></u-button>
						</view>
					</view>

				</view>
			</view>
		</view>
	</scroll-view>
</template>

<script>
	import {
		ocouponList,
	} from '@/api/url.js'
	export default {
		data() {
			return {
				list1: [{
					name: '未使用',
				}, {
					name: '已使用',
				}],
				columns: [],
				columnsList: [],
				yhqlist: [],
				params: {
					pageNum: 1,
					pageSize: 10,
					usageStatus:0
				},
				token: uni.getStorageSync("token")
			};
		},

		computed: {

		},
		onShow() {

		},
		onLoad() {
			this.list()
		},
		methods: {
			click(item) {
				console.log('item', item.index);
				this.params.usageStatus=item.index
				this.list()
			},
			list() {
				ocouponList(this.params, this.token).then(res => {
					console.log(res)
					this.yhqlist = res.data.rows
				})
			}
		},
	};
</script>

<style lang="scss" scoped>
	@import "./index.scss";

	.quan {
		.title {
			font-weight: 600;
		}

		.qian {
			color: red;
			font-weight: 600;
		}

		.time {
			color: #AAAAAA;
			font-size: 24rpx;
		}

		.man {
			color: #2C2C2C;
			font-size: 30rpx;
		}
	}
</style>